dist: xenial
language: ruby
sudo: false
rvm:
- 2.5.3
gemfile: spec/gemfiles/ci.gemfile
env:
  global:
  - TRAVIS=1 CI=1 COVERAGE=1
matrix:
  include:
    - name: Rubocop
      gemfile: spec/gemfiles/rubocop.gemfile
      rvm: 2.5.3
      script: bundle exec rubocop
      cache:
        directories:
        - $TRAVIS_BUILD_DIR/vendor/bundle
      before_install:
      - bundle config set path $TRAVIS_BUILD_DIR/vendor/bundle
      before_script:
      after_script:
      addons:
        apt:
          packages: []
    - name: SQLite
      env: DB=sqlite3
    - name: --no-webpack-js
      env: DB=sqlite3 THREDDED_CREATE_APP_BIN_ARGS=--no-webpack-js
    - name: MySQL
      env: DB=mysql2 DB_USERNAME=root DB_PASSWORD=""
      services: mysql
    - name: PostreSQL
      env: DB=postgresql DB_USERNAME=postgres DB_PASSWORD=""
      services: postgresql
before_install:
- gem update --system --no-document --quiet
- gem install bundler --no-document
- bundle config set path $TRAVIS_BUILD_DIR/vendor/bundle && bundle config set without debug
- bash .travis.setup.sh
- nvm use node
cache:
  directories:
  - $TRAVIS_BUILD_DIR/vendor/bundle
  - tmp/myapp-bundle-cache
  - /home/travis/.rvm/ # for caching `gem install rails` results

# Avoid rake here, as the RSpec test task spawns a new process which does not run via bundler.
script: "bundle exec rspec --format d && bundle exec codeclimate-test-reporter"
